package newsmessages.factorymethod;

import newsmessages.abstract_factory.AbstractFactoryMessage;
import newsmessages.abstract_factory.factories.ElderlyMessageFactory;
import newsmessages.abstract_factory.factories.TeenageMessageFactory;
import newsmessages.decorator.Message;

/**
 * Created with IntelliJ IDEA.
 * User: jeroen
 * Date: 4/8/13
 * Time: 4:50 PM
 * To change this template use File | Settings | File Templates.
 */
public class CreateMessage {

    public Message createMessage(String choice) {
        AbstractFactoryMessage ff;
        Message m = new Message();
        if (choice.equals("Elderly")) {
            ff = new ElderlyMessageFactory();
        } else {
            ff = new TeenageMessageFactory();
        }

        m.setHeader(ff.createHeader());
        m.setContent(ff.createContent());
        m.setFooter(ff.createFooter());

        return m;
    }
}
